using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Oracle.DataAccess.Client;using Oracle.DataAccess.Types;

public partial class MenuPrincipal : System.Web.UI.UserControl
{
//    OracleConnection oraDb;
    protected void Page_Load(object sender, EventArgs e)
    {
/*        if (!Page.IsPostBack)
        {
            oraDb = DBConnection.GetConnection();

            String sql_tree = "select level_code, '  ' || trim(description) || '  ', length(level_code), replace(level_code, '.'), substr(level_code, 0, 2), component_url from v_tree order by level_code";

            OracleDataAdapter da = new OracleDataAdapter(sql_tree, oraDb);

            DataSet ds = new DataSet();
            da.Fill(ds);

            MenuItem Pai = null;
            MenuItem mnItem1 = null, mnItem2 = null, mnItem3 = null, mnItem4 = null;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                switch (Convert.ToInt16(ds.Tables[0].Rows[i][2].ToString()))
                {
                    case 2:
                        mnItem1 = null; mnItem2 = null; mnItem3 = null; mnItem4 = null;
                        switch (Convert.ToInt16(ds.Tables[0].Rows[i][0].ToString()))
                        {
                            case 5:
                                Pai = tvNavigator.Items[0];
                                break;
                            case 10:
                                Pai = tvNavigator.Items[1];
                                Pai.Selectable = true;
                                break;
                            case 15:
                            case 20:
                            case 25:
                            case 30:
                                Pai = new MenuItem(ds.Tables[0].Rows[i][1].ToString());
                                tvNavigator.Items[2].ChildItems.Add(Pai);
                                break;
                            case 35:
                                Pai = tvNavigator.Items[3];
                                break;
                            case 40:
                                Pai = tvNavigator.Items[4];
                                break;
                            case 45:
                            case 50:
                            case 55:
                            case 60:
                            case 65:
                            case 68:
                            case 69:
                            case 70:
                            case 71:
                            case 72:
                            case 73:
                            case 76:
                                Pai = new MenuItem(ds.Tables[0].Rows[i][1].ToString());
                                tvNavigator.Items[5].ChildItems.Add(Pai);
                                break;
                            case 78:
                            case 80:
                            case 85:
                                Pai = new MenuItem(ds.Tables[0].Rows[i][1].ToString());
                                tvNavigator.Items[6].ChildItems.Add(Pai);
                                break;
                            case 90:
                                Pai = tvNavigator.Items[7];
                                break;
                        }
                        break;
                    case 5:
                        MenuItem pai_atual = null, filho_atual = null;
                        if (mnItem1 != null)
                        {
                            pai_atual = mnItem1;
                            mnItem2 = new MenuItem();
                            filho_atual = mnItem2;
                        }
                        else
                        {
                            pai_atual = Pai;
                            mnItem1 = new MenuItem();
                            filho_atual = mnItem1;
                        }
                        filho_atual.Text = ds.Tables[0].Rows[i][1].ToString();
                        filho_atual.NavigateUrl = (ds.Tables[0].Rows[i][5].ToString() == null ? "#" : ds.Tables[0].Rows[i][5].ToString());
                        pai_atual.ChildItems.Add(filho_atual);

                                mnItem1 = null;
                                mnItem2 = null;
                                mnItem3 = null;
                                mnItem4 = null;
                        break;
                }
            }
        }*/
    }
}
